using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class EnemyHealth : EntityHealth
{
    private Enemy_Stat _enemyStat;
    public UnityEvent<Vector2> OnHurt;
    public UnityEvent<Vector2> OnDead;
    protected override void Awake()
    {
        base.Awake();
        _enemyStat = GetComponent<Enemy_Stat>();

        currentHealth = _enemyStat.GetMaxHealth();
    }
    public override bool ReduceHealth(float damage, Vector2 hurtDir)
    {
        bool isHurt = base.ReduceHealth(damage, hurtDir);
        if (isHurt)
            OnHurt?.Invoke(hurtDir);
        else
            OnDead?.Invoke(hurtDir);

        return isHurt;
    }
}
